package com.rapid.maintenance.ui.activity.machining;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.rapid.maintenance.R;
import com.rapid.maintenance.adapter.MachiningBusinessAdapter;
import com.rapid.maintenance.adapter.SimpleSliderAdapter;
import com.rapid.maintenance.base.BaseActivity;
import com.youth.banner.Banner;
import com.youth.banner.Transformer;
import com.youth.banner.loader.ImageLoader;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MachiningShareActivity extends BaseActivity {

    @BindView(R.id.rv_machining_business)
    RecyclerView rvMachiningBusiness;
    @BindView(R.id.slider)
    RecyclerView slider;
    @BindView(R.id.drawer)
    DrawerLayout drawer;
    @BindView(R.id.banner)
    Banner banner;
    private MachiningBusinessAdapter mAdapter;
    private SimpleSliderAdapter sliderAdapter;

    @Override
    protected int provideRootLayout() {
        return R.layout.activity_machining_share;
    }

    @Override
    protected void init() {
        setTitle("共享设备分类");
        setStatusBarColor(0xFF016DB6);
        setToolBarColor(0xFF016DB6);
        rvMachiningBusiness.setAdapter(mAdapter = new MachiningBusinessAdapter());
        mAdapter.addData(new Object());
        mAdapter.addData(new Object());
        mAdapter.addData(new Object());
        mAdapter.addData(new Object());
        mAdapter.addData(new Object());
        mAdapter.addData(new Object());


        slider.setAdapter(sliderAdapter = new SimpleSliderAdapter());
        sliderAdapter.setOnSelectCallBack(s -> startActivity(new Intent(this, DeviceShareListActivity.class).putExtra("data", s)));

        sliderAdapter.addData("数控机床");
        sliderAdapter.addData("传动系统");
        sliderAdapter.addData("机床主体");
        sliderAdapter.addData("进口设备");
        sliderAdapter.addData("装配组件");
        sliderAdapter.addData("设备改造");
        sliderAdapter.addData("注 塑 机");
        List<Integer> images = new ArrayList<>();
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        banner.setImageLoader(new ImageLoader() {
            @Override
            public void displayImage(Context context, Object path, ImageView imageView) {
                Glide.with(imageView).load(path).into(imageView);
            }
        }).setBannerAnimation(Transformer.DepthPage).setImages(images).start();
    }

    @OnClick({R.id.tv_classify, R.id.tv_search, R.id.rl_equipment_type, R.id.rl_processing_technology, R.id.tv_more})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_classify:
                break;
            case R.id.tv_search:
                break;
            case R.id.rl_equipment_type:
                drawer.openDrawer(slider);
                break;
            case R.id.rl_processing_technology:
                break;
            case R.id.tv_more:
                break;
        }
    }

}
